<template>
  <div v-if="showTip" class="herin-tip-box">
    <div :class="['tip-icon', 'iconfont', info.icon]" />
    <div class="herin-tip-text">{{ info.text }}</div>
  </div>
</template>

<script>
const showMessage = {
  'empty': {
    'icon': 'iconkong',
    'text': '暂无数据'
  },
  'search': {
    'icon': 'iconzanwushuju2',
    'text': '抱歉,未查询到相应数据'
  }
};
export default {
  name: 'HerinTip',
  props: {
    showTip: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: 'empty'
    }
  },
  data() {
    return {
      info: {}
    };
  },
  watch: {
    type(val) {
      this.getMessage(val);
    }
  },
  created() {
    this.getMessage(this.type);
  },
  methods: {
    getMessage(val) {
      this.info = showMessage[val];
    }
  }
};
</script>

<style lang="scss" scoped>
.herin-tip-box{
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
  min-width: 300px;
  min-height: 100px;
  font-size: 1rem;
  color: #8E8E8E;
  .tip-icon{
    font-size: 3.75rem;
  }
  .herin-tip-text{
    margin-top: .9375rem;
  }
}
</style>

